<template>
  <div>
    <Form label-position="right" :label-width="400">
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">姓名：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Input v-model="formDate.name" placeholder="请输入姓名"></Input>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">性别：</Col>
        <Col span="12" class="ivu-form-item-content">
          <RadioGroup v-model="formDate.sex">
            <Radio label="男">
                <span>男</span>
            </Radio>
            <Radio label="女">
                <span>女</span>
            </Radio>
          </RadioGroup>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">手机号：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Input v-model="formDate.mobile" placeholder="请输入手机号"></Input>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">证件类型：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Select v-model="formDate.card_type" placeholder="请选择证件类型">
            <Option value="1">身份证</Option>
            <Option value="2">军官证</Option>
            <Option value="3">护照</Option>
            <Option value="4">港澳通行证</Option>
          </Select>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">证件号码：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Input v-model="formDate.card_no" placeholder="请输入证件号码"></Input>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">地址：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Input v-model="formDate.address" placeholder="请输入地址"></Input>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">近14天湖北省旅居史：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Input v-model="formDate.is_hubei" placeholder="请输入近14天湖北省旅居史"></Input>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">近14天是否接触确诊或疑似病例：</Col>
        <Col span="12" class="ivu-form-item-content">
          <RadioGroup v-model="formDate.is_contact">
            <Radio label="是">
                <span>是</span>
            </Radio>
            <Radio label="否">
                <span>否</span>
            </Radio>
          </RadioGroup>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">当前健康状况：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Input v-model="formDate.health_state" placeholder="请输入当前健康状况"></Input>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">当前体温：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Input v-model="formDate.temperature" placeholder="请输入当前体温"></Input>
        </Col>
      </Row>
      <Row class="mb20">
        <Col span="7" class="ivu-form-item-label">14天内停留城市：</Col>
        <Col span="12" class="ivu-form-item-content">
          <Input v-model="formDate.stay_city" placeholder="请输入14天内停留城市"></Input>
        </Col>
      </Row>
    </Form>
  </div>
</template>

<script>
export default {
  props: {
    formDate: {
      type: Object,
      default: () => {
        return {
          card_type: '1'
        }
      }
    },
    personFormInfo: Object
  },
  name: 'personForm',
  data () {
    return {
    }
  },
  watch: {
    // 回显
    // personFormInfo (a) {
    //   this.formDate = a
    // }
  },
  mounted () {
    this.formDate.card_type = '1'
  },
  methods: {
    save () {
      if (this.formDate.name === '' || this.formDate.name === undefined || this.formDate.name === null) {
        this.$Notice.error({ title: '请输入姓名', desc: '' })
        return false
      }
      if (this.formDate.sex === '' || this.formDate.sex === undefined || this.formDate.sex === null) {
        this.$Notice.error({ title: '请选择性别', desc: '' })
        return false
      }
      if (this.formDate.mobile === '' || this.formDate.mobile === undefined || this.formDate.mobile === null) {
        this.$Notice.error({ title: '请输入手机号码', desc: '' })
        return false
      }
      if (this.formDate.card_type === '' || this.formDate.card_type === undefined || this.formDate.card_type === null) {
        this.$Notice.error({ title: '请选择证件类型', desc: '' })
        return false
      }
      if (this.formDate.card_no === '' || this.formDate.card_no === undefined || this.formDate.card_no === null) {
        this.$Notice.error({ title: '请输入证件号码', desc: '' })
        return false
      }
      if (this.formDate.address === '' || this.formDate.address === undefined || this.formDate.address === null) {
        this.$Notice.error({ title: '请输入地址', desc: '' })
        return false
      }
      if (this.formDate.is_hubei === '' || this.formDate.is_hubei === undefined || this.formDate.is_hubei === null) {
        this.$Notice.error({ title: '请输入近14天湖北省旅居史', desc: '' })
        return false
      }
      if (this.formDate.is_contact === '' || this.formDate.is_contact === undefined || this.formDate.is_contact === null) {
        this.$Notice.error({ title: '请选择近14天是否接触确诊或疑似病例', desc: '' })
        return false
      }
      if (this.formDate.health_state === '' || this.formDate.health_state === undefined || this.formDate.health_state === null) {
        this.$Notice.error({ title: '请输入当前健康状况', desc: '' })
        return false
      }
      if (this.formDate.temperature === '' || this.formDate.temperature === undefined || this.formDate.temperature === null) {
        this.$Notice.error({ title: '请输入当前体温', desc: '' })
        return false
      }
      if (this.formDate.stay_city === '' || this.formDate.stay_city === undefined || this.formDate.stay_city === null) {
        this.$Notice.error({ title: '请输入14天内停留城市', desc: '' })
        return false
      }
      this.$emit('checkPerson', this.formDate)
    }
  }
}
</script>

<style scoped>
  .ivu-row{
    margin-bottom: 15px;
  }
</style>
